import Vue from "vue"
import router from "./router"
import store from "./store"

import directives from "./directive"
import filters from "./filters/index"
import { setUrlToken } from "./utils/auth"
// import { setTheme } from "./utils/changeTheme"
import appComponent from "./components/index"
import * as prototypeUtils from "./utils/prototype"
import { removeMessage } from "./utils/message"
import ElementUI from "element-ui"

import "@/assets/scss/reset.scss"
import "nprogress/nprogress.css"

import "element-ui/lib/theme-chalk/index.css"

import Vant from "vant"
import "vant/lib/index.css"

import "./assets/style.css"

import Router from "vue-router"
import OladingBusinessUI from "@olading/olading-business-ui"
import "@olading/olading-business-ui/dist/olading-business-ui.css"
import { setFavicon } from "./utils"
const { createDesktopApp } = OladingBusinessUI

Vue.use(prototypeUtils.install(prototypeUtils))
Vue.use(ElementUI)
Vue.use(appComponent)
Vue.use(directives)
Vue.use(OladingBusinessUI)
Vue.use(filters)
Vue.use(Vant)

// 监听离开当前页签，关闭消息提示框
document.addEventListener("visibilitychange", removeMessage)

// 设置主题相关
// setTheme()
// 通过URL设置TOKEN
setUrlToken()
// 设置网站favicon
setFavicon()

createDesktopApp(
  {
    basePath: router.base,
    store,
    menus: [],
    routes: [],
    modules: router.options.routes,
    routerModule: {
      router: Router
    },
  },
  "#app"
)